﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lswweb.Model;
using Lswweb.Domain;

namespace Lswweb.Controls
{
    public class IsHotHandler : ModelHandler
    {
        protected override void Handler(int id, Lswweb.Model.SiteModule type)
        {
            switch (type)
            {
                case SiteModule.News :
                    News.UpdateIsHot(id,IsHot);
                    break;
                case SiteModule.Product:
                    Products.UpdateIsHot(id,IsHot);
                    break;
                case SiteModule.ProductStorage:
                    ProductStorage.UpdateIsHot(id,IsHot);
                    break;
                default:
                    break;
            }
        }

        public bool IsHot
        {
            get 
            {
                var result = SiteContext.Current.IsTrue;
                if (result == null)
                    return false;

                return result.Value;
            
            }
        }
    }
}
